import os,sys
import pandas as pd
import emotion_config as e_config

def readEmotionDict():
    df_data = pd.read_excel(e_config.dlu_emotion_dict_path)
    columns = ['词语','情感分类','强度','极性']
    # print(df_data.info())
    print('----------------------------------------')
    df_simple_data = df_data[columns]
    # print(df_simple_data.head())
    # 选情感类别作为分组标准，用聚合函数统计出现次数，降序排序
    df_simple_groupby_emot_cato = df_simple_data.groupby(["情感分类"],as_index=False).\
           agg({"词语":'count'}).sort_values(by=['词语'],ascending=False)
    # print(df_simple_groupby_emot_cato.head())

    return df_simple_data,df_simple_groupby_emot_cato


if __name__ == "__main__":
    readEmotionDict()